import React from "react";

const List = (props) => {
  const remove = (id) => () => {
    props.onRemove(id);
  };

  return (
    <ul>
      {props.list.map((item) => (
        <li key={item.id}>
          {item.name} - <button onClick={remove(item.id)}>删除</button>
        </li>
      ))}
    </ul>
  );
};

export default List;
